4
4
.
.
1
1
.
.
4
4
T
T
e
e
x
x
t
t
I
I
n
n
f
f
o
o
[
[
R
R
]
]
Text View displays a text (it is used as a label).
www.iosfonts.com contains list of available custom fonts.
S
S
i
i
m
m
p
p
l
l
e
e
T
T
e
e
x
x
t
t
V
V
i
i
e
e
w
w
Code
Text("First line.\nSecond line.")
View
S
S
h
h
a
a
d
d
o
o
w
w
T
T
e
e
x
x
t
t
V
V
i
i
e
e
w
w
Code
Text("Hello, World!")
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.top, padding)
.font(.body)
.font(Font.custom("Arial Rounded MT Bold", size: 18))
.fontWeight(.bold)
.foregroundColor(Color.red)
.shadow(color: Color.black, radius: 2, x: 2, y: 2)
View
B
B
u
u
t
t
t
t
o
o
n
n
l
l
i
i
k
k
e
e
T
T
e
e
x
x
t
t
V
V
i
i
e
e
w
w
This is useful when using Text as NavigationLink inside NavigationView when Text View actually performs like a button.
Code
Text("SwiftUI")
.font(.title)
.padding(10.0)
.background(Color.blue)
.foregroundColor(Color.white)
.cornerRadius(18.0)
View
S
S
t
t
y
y
l
l
e
e
d
d
T
T
e
e
x
x
t
t
V
V
i
i
e
e
w
w
Code
VStack {
Text("First line.\nSecond line.\nThird line")
.tracking(0.8) //spread characters apart
.tracking(-0.6) //bring characters closer
.bold()
.italic()
.underline()
.strikethrough()
.fontWeight(.ultraLight)
.font(.largeTitle)
.foregroundColor(Color.red)
.background(Color.yellow)
.lineLimit(2)
.padding(10.0)
Text("Simple ") + Text("Swift ") + Text("Guide")
}
View